<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">

	<head >
	
		<!-- Basic -->
    	<meta charset="UTF-8" />

		<title>云收藏 | 最好用的网页收藏工具</title>
		
		<!-- Mobile Metas -->
	    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<!-- Vendor CSS-->
		<link href="/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
		<link href="/vendor/skycons/css/skycons.css" rel="stylesheet" />
		<link href="/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
		
		<!-- Plugins CSS-->		
		
		<!-- Theme CSS -->
		<link href="/css/jquery.mmenu.css" rel="stylesheet" />
		
		<!-- Page CSS -->		
		<link href="/css/style.css" rel="stylesheet" />
		<link href="/css/add-ons.min.css" rel="stylesheet" />
		
		<style>
			footer {
				display: none;
			}
		</style>
		
		<!-- end: CSS file-->	
	    
		
		<!-- Head Libs -->
		<script src="../static/plugins/modernizr/js/modernizr.js"></script>
		

		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
			<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
		<![endif]-->		
		
	</head>

	<body>
		<!-- Start: Content -->
		<div class="container-fluid content">
			<div class="row">
				<!-- Main Page -->
				<div class="body-login">
					<div class="center-login">
						<a href="#" class="logo pull-left hidden-xs">
							<h2 style ="color:#5f5f5f">favorite</h2>
						</a>

						<div class="panel panel-login">
							<div class="panel-title-login text-right">
								<h2 class="title"><i class="fa fa-user"></i> 用户登录</h2>
							</div>
							<div class="panel-body">

									<div class="form-group">
										<label>账号</label>
										<div class="input-group ">
											<input id="username1" name="username" type="text" class="form-control bk-noradius" />
											<span class="input-group-addon">
												<span class="icon">
													<i class="fa fa-user"></i>
												</span>
											</span>
										</div>
									</div>

									<div class="form-group">
										<label>密码</label>
										<div class="input-group ">
											<input id="password1" name="password" type="password" class="form-control bk-noradius" />
											<span class="input-group-addon">
												<span class="icon">
													<i class="fa fa-lock"></i>
												</span>
											</span>
										</div>
									</div>
									<br />
									<div class="row">
										<div class="col-sm-8">
											<div class="checkbox-custom checkbox-default bk-margin-bottom-10">
												<input id="RememberMe" name="rememberme" type="checkbox"/>
												<label for="RememberMe">记住我</label>
											</div>
										</div>
										<div class="col-sm-4 text-right">
											<button onclick="tologin()"  type="submit" class="btn btn-primary hidden-xs">登录</button>
											<!--<button href="index.html" type="submit" class="btn btn-primary btn-block btn-lg visible-xs bk-margin-top-10">Login</button>-->
										</div>
									</div>

									<br />
									<div class="text-with-hr">
										<span>or</span>
									</div>

									<p class="text-center">还没注册吗? <a href="/toregister" style ="color:#5f5f5f"><small>去注册</small></a>

							</div>
						</div>
					</div>
				</div>
		
			</div>
		</div><!--/container-->
		
		
		<!-- start: JavaScript-->

		<script>
            function tologin() {

                $.ajax({
                    type:"POST",
                    dataType:"JSON",
                    contentType: "application/json;charset=UTF-8",
                    url:"/login",
                    data:JSON.stringify({
                        userName:$("#username1").val(),
                        passWord:$("#password1").val()
                    }),
                    success:
                        function (Response) {
                      		if(Response.code==0){
                      		    console.log(Response.msg.token);
                      		   	localStorage.setItem("token",Response.msg.token);
                                localStorage.setItem("id",Response.msg.user.id);

                      		    window.location.href="/toindex";
							}
							if(Response.code==500){
							alert(Response.msg);
							}
                        },
                    error:function () {
                        alert("提交错误！");
                    }
                })


            }
		</script>>
		<!-- Vendor JS-->				
		<script src="/vendor/js/jquery.min.js"></script>
		<script src="/vendor/js/jquery-2.1.1.min.js"></script>
		<script src="/vendor/js/jquery-migrate-1.2.1.min.js"></script>
		<script src="/vendor/bootstrap/js/bootstrap.min.js"></script>
		<script src="/vendor/skycons/js/skycons.js"></script>
		
		<!-- Plugins JS-->
		
		<!-- Theme JS -->		
		<script src="/js/jquery.mmenu.min.js"></script>
		<script src="/js/core.min.js"></script>
		
		<!-- Pages JS -->
		<script src="/js/pages/page-login.js"></script>
		
		<!-- end: JavaScript-->



	</body>
	
</html>